package io.bdmc.modules.bss.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.bdmc.common.annotation.Excel;
import io.bdmc.common.utils.DateUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 单盘风扇数据 实体
 * </p>
 *
 * @author 黄露
 * @since 2021-04-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
// "DeviceMachineFan对象", description = "单盘风扇数据")
public class DeviceMachineFan extends Model<DeviceMachineFan> {

  private static final long serialVersionUID = 1L;

  @TableId(value = "fan_id", type = IdType.AUTO)
  private Integer fanId;

  private Boolean intervalSave;
  // // "单盘id")
  // private Integer machineDiskId;
  @Excel(name = "单盘SN")
  private String diskSn;

  // "设备id")
  private Integer deviceId;

  // "风扇名称")
  @Excel(name = "风扇名称")
  private String fanName;

  // "模式")
  private Integer fanMode;

  // "状态")
  @Excel(name = "风扇状态")
  private String fanStatus;

  // "转速")
  @Excel(name = "风扇转速")
  private Integer fanRpm;

  // "风扇编号")
  private Integer fanNum;

  // "最低转速")
  private Integer fanMinRpm;

  // "最高转速")
  private Integer fanMaxRpm;

  // "风扇寿命")

  private Integer fanLife;

  // "运行时间")
  private Integer runTime;

  // "创建时间")
  @Excel(name = "创建时间")
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private LocalDateTime createTime;

  @TableField(exist = false)
  @Excel(name = "风扇寿命")
  private String fanLifeDesc;

  public String getFanLifeDesc() {
    return DateUtils.getDayHourMinute(fanLife / 60);
  }

  @TableField(exist = false)
  @Excel(name = "运行时间")
  private String runTimeDesc;

  public String getRunTimeDesc() {
    return DateUtils.getDayHourMinute(runTime / 60);
  }

  @Override
  public Serializable pkVal() {
    return this.fanId;
  }

}
